#include <stdio.h>

#define MAX_LINE_LENGTH 256
#define MAX_PROGRAM_SIZE 1024

int main(int argc, char** argv)
{
    if (argc != 2 && argc != 3)
    {
        printf("Usage: asm <program file> [output file]\n");
        printf("<program file>: Required, the bitvm program written in bitvm assembly language.\n");
        printf("[output file]: Optional, the output binary file.\n");
        return 1;
    }

    char* src_filename = argv[1];
    char* out_filename = "out.bin";
    if (argc == 3)
    {
        out_filename = argv[2];
    }

    FILE* src_file = fopen(src_filename, "r");
    if (src_file == NULL)
    {
        perror("Error opening source file\n");
        return 1;
    }

    char line[MAX_LINE_LENGTH];
    while(fgets(line, MAX_LINE_LENGTH, src_file) != NULL)
    {
        // Process each line of the assembly file
        // For now, we just print it to stdout
        printf("%s", line);
    }

    return 0;
}